<template>
  <div class="app-container">

    <el-form :model="queryParams" ref="queryForm" :inline="true" @submit.native.prevent>
      <el-form-item label="输入job名称" prop="jobName">
        <el-input v-model="queryParams.jobName" placeholder="请输入job名称" clearable size=" small" style="width: 240px"/>
      </el-form-item>

      <el-button  icon="el-icon-search" circle @click = "getList()"/>
    </el-form>

    <el-row :gutter="10" class="mb8">
    </el-row>
    <el-table v-loading="loading" :data="dataList">
      <el-table-column label="实例Job名称" prop="jobName" :show-overflow-tooltip="true" />
      <el-table-column label="日志信息" prop="logMsg" :show-overflow-tooltip="true" />
      <el-table-column label="处理时间" prop="dealTime" :show-overflow-tooltip="true" />
    </el-table>
    <pagination v-show="total>0" :total="total" :page.sync="pageLimit.pageNum" :limit.sync="pageLimit.pageSize"
      @pagination="getList" />
  </div>


</template>

<script>
  import {
    listLogs
  } from "@/api/job/runlogs";
  export default {
    name: "runlogs",
    data() {
      return {
        // 遮罩层
        loading: true,
        // 总条数
        total: 0,
        dataList: [],
        // 日期范围
        dateRange: [],
        statusOptions: [],
        // 查询参数
        queryParams: {},
        pageLimit: {
          pageSize: 10,
          pageNum: 1
        },
      };
    },
    created() {
      this.queryParams.instanceId = this.$route.query.instanceId;
      this.getList();
    },
    methods: {
      /** 查询列表 */
      getList() {
        this.loading = true;
        console.log(this.queryParams)
        listLogs(this.queryParams, this.pageLimit).then(
          response => {
            this.dataList = response.data.list;
            this.total = response.data.total;
            this.loading = false;
          }
        );
      },
      /** 搜索按钮操作 */
      handleQuery() {
        this.pageLimit.pageNum = 1;
        this.pageLimit.pageSize = 10;
        this.getList();
      },
      /** 重置按钮操作 */
      resetQuery() {
        this.dateRange = [];
        this.resetForm("queryForm");
        this.handleQuery();
      },
    },

  };
</script>
